package com.inossem.warehousestorage_inossem.request.allocation;

import android.content.Context;

import com.google.gson.Gson;
import com.inossem.warehousestorage_inossem.bean.allocation.AllocationInSubmitBean;
import com.inossem.warehousestorage_inossem.constant.RequestConstant;
import com.inossem.warehousestorage_inossem.listener.GsonBeanListener;
import com.inossem.warehousestorage_inossem.listener.StringRequestListener;
import com.inossem.warehousestorage_inossem.manage.RequestManage;
import com.inossem.warehousestorage_inossem.model.StringResponse;
import com.inossem.warehousestorage_inossem.request.Request;

/**
 * TODO
 *
 * @author 詹建宇
 * @time on 2018/4/9 15:16
 * @email jianyu.zhan@inossem.com
 */
public class AllocationInSubmitRequest extends Request {

    public static String request(Context context, String json, GsonBeanListener gsonBeanListener) {
        String tag;
        String url = RequestManage.getUrl(context, RequestConstant.URL_ALLOCATION_IN_SUBMIT );
        tag = RequestManage.getHttpsPostWithLoading(context, url,json, new StringRequestListener() {
            @Override
            public void onSuccess(StringResponse stringRequestResponse) {
                Gson gson = new Gson();
                AllocationInSubmitBean bean = gson.fromJson(stringRequestResponse.getResponseInfo(), AllocationInSubmitBean.class);
                excuteJsonBeanNew(context, bean, gsonBeanListener);
            }
        });
        return tag;
    }

}
